package com.ww.scm.entity;


import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.codehaus.jackson.annotate.JsonProperty;
import org.hibernate.annotations.GenericGenerator;

/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * 子类可重载getId()函数重定义id的列名映射和生成策略.
 * 
 */
//JPA 基类的标识
@MappedSuperclass
public class AbstractEntity {

	//主键
	@JsonProperty
	protected String id;
	//备注
	protected String remark;
	//系统标识
	protected String sysFlag;
	//创建人
	protected String creator;
	//创建时间
	protected String createTime;
	//最后修改人
	protected String lastModifier;
	//最后修改时间
	protected String lastModifiedTime;
	
	@Id
	@Column(name="F_ID",nullable=false,length = 32)
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	public String getId() {
		return id;
	}

	@Column(name="F_REMARK",length = 2048)
	public String getRemark() {
		return remark;
	}

	@Column(name="F_SYS_FLAG",length = 1)
	public String getSysFlag() {
		return sysFlag;
	}

	@Column(name="F_CREATOR",length = 32)
	public String getCreator() {
		return creator;
	}
	
	@Column(name="F_CREATE_TIME",length=14)
	public String getCreateTime() {
		return createTime;
	}
	
	@Column(name="F_LAST_MODIFIER",length = 32)
	public String getLastModifier() {
		return lastModifier;
	}
	
	@Column(name="F_LAST_MODIFIED_TIME" ,length=14)
	public String getLastModifiedTime() {
		return lastModifiedTime;
	}
	
	
	
	
	public void setId(String id) {
		this.id = id;
	}
	
	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setSysFlag(String sysFlag) {
		this.sysFlag = sysFlag;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public void setLastModifier(String lastModifier) {
		this.lastModifier = lastModifier;
	}

	public void setLastModifiedTime(String lastModifiedTime) {
		this.lastModifiedTime = lastModifiedTime;
	}
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
